/*_____________________________________________________________________________
||
|| STM32 Baremetal Driver
||
|| Jinfeng Zhuang, 2024.W18
||
|| Additional Feature: SWIP wrapper
||_____________________________________________________________________________
*/

typedef volatile unsigned short VU32;

typedef struct
{
    VU32 CR1;       // Dir, NSS, Prescale, Master/Slave, CPOL & CPHA
    VU32 CR2;       // Interrupt
    VU32 SR;        // Status
    VU32 DR;        // Data
    VU32 CRCPR;     // CRC
    VU32 RXCRCR;    // CRC
    VU32 TXCRCR;    // CRC
    VU32 I2SCFGR;   // Use I2S or SPI
    VU32 I2SPR;     // I2S
} SPI_TypeDef;

// PP: Push-Pull, Output ONLY, like PWM
// OD: I2C, SPI, Input/Output
static void init(U32 base, U32 port, U32 pin, U32 pp)
{
    SPI_TypeDef* GPIOx = (SPI_TypeDef*)base;
    U32          tmp;
}

/*_____________________________________________________________________________
||
|| Wrapper of SWIP
||
|| Include Port related macros.
|| Self compile code, if user want use it, redefine the macros.
||
*/

enum SWIP_CMD
{
    SWIP_CMD_BASE,
};

static U32 reg_base[8];

U32 event_handler_soc_spi(U32 index, U32 cmd, U32 param1, U32 param2)
{
    switch (cmd)
    {
    case SWIP_CMD_BASE:
        reg_base[index] = param1;
        break;
    }
}